var ld=(document.all);

var ns4=document.layers;
var ns6=document.getElementById&&!document.all;
var ie4=document.all;

var oldhtml;

function cls() {
    oldhtml = document.body.innerHTML;
    document.body.innerHTML="";
}

function restore() {
    document.body.innerHTML = oldhtml;
}

function init()
{

    if (ns4)
	ld=document.loading;
    else if (ns6)
	ld=document.getElementById("loading").style;
    else if (ie4)
	ld=document.all.loading.style;

    if(ns4) 
        ld.visibility="hidden";
    else if (ns6||ie4)  {
        ld.display="none";
    }

}

function getItem(id)
{
    var itm = false;
    if(document.getElementById)
        itm = document.getElementById(id);
    else if(document.all)
        itm = document.all[id];
    else if(document.layers)
        itm = document.layers[id];

    return itm;
}

function toggleAll(dowhat)
{
    var tags = document.getElementsByTagName('tbody');

    if(!tags)
        return false;

    for(var i = 0; i < tags.length; i++)
    {
        if(tags[i].className == 'collapse_obj')
        {
            if(dowhat == 'collapse')
                tags[i].style.display = 'none';
            else
                tags[i].style.display = '';
        }
    }

    return false;

}

function toggleItem(id)
{
    itm = getItem(id);

    if(!itm)
        return false;

    if(itm.style.display == 'none')
        itm.style.display = '';
    else
        itm.style.display = 'none';

    return false;

}
